fix: authentication error log on agent gateway integration - #267
Merged
Conversation
NicoleMGomes
force-pushed
the
fix/agw-auth-destination-log
branch
from
August 12, 2026 22:49
f4f58e3 to
581439a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
When the Destination Service returns an auth token with a non-empty
errorfield (e.g."No consumed apis matching provided resource parameter found."), the Agent Gateway LoB flow previously raised a generic"Empty auth header"error with no indication of the underlying cause.This fix surfaces the Destination Service error message directly in the raised exception:
error: Optional[str]field to theAuthTokendataclass, populated from the"error"key in the Destination Service v2 API response.AuthToken.from_dictto raiseDestinationOperationErrorwith the Destination Service error message when a token carries anerrorfield alongside emptytype/value/http_header.Destination.from_dict), it propagates naturally throughget_destinationto the caller without any special handling in the Agent Gateway layer.Type of Change
How to Test
resourceparameter causing"No consumed apis matching provided resource parameter found.").fetch_system_authorfetch_user_auth)."Empty auth header"message.Alternatively, run the unit tests:
Checklist
Additional Notes
The
errorfield is part of the Destination Service OpenAPI spec forauthTokensbut was previously not modelled inAuthToken. The fix is fully backward-compatible: tokens without anerrorfield parse as before, andAuthToken.errordefaults toNone. Tokens that carry a non-emptyerroralongside empty required fields now raiseDestinationOperationErrorat parse time with the service-provided message included.